package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderPayLogDto;
import com.lzy.cloud.order.dtos.pay.OrderPayParamsDto;
import com.lzy.cloud.order.entity.OrderPayLog;
import com.lzy.cloud.order.mapper.OrderPayLogMapperExt;
import com.lzy.cloud.order.service.OrderPayLogService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 订单交易记录
 * @Author:   gyl
 * @Date:     2018/7/10 19:05
 */
@Service
public class OrderPayLogServiceImpl implements OrderPayLogService {

    @Autowired
    private OrderPayLogMapperExt orderPayLogMapperExt;

    @Override
    public List<OrderPayLogDto> queryListByOrderId(String orderId) {
        return orderPayLogMapperExt.queryListByOrderId(orderId);
    }

    @Override
    public Long create(OrderPayLogDto orderPayLogDto) {
        OrderPayLog orderPayLog = DozerUtils.map(orderPayLogDto, OrderPayLog.class);
        return orderPayLogMapperExt.insertSelective(orderPayLog)>0 ? orderPayLog.getId() : 0 ;
    }

    @Override
    public Boolean updateByOrderId(OrderPayLogDto orderPayLogDto) {
        return orderPayLogMapperExt.updateByOrderId(orderPayLogDto) > 0;
    }
}
